package array;

public class deleteElement {
    public int[] removeDuplicates(int[]array){
        int j=0;
        for (int i = 1; i < array.length; i++) {
            if (array[i]!=array[j]){
                j++;
                array[j]=array[i];

            }
        }
        return array;
    }

    public static void main(String[] args) {
        int[]array={1,2,2,2,3,4,5,6,7,8,9};
        deleteElement element = new deleteElement();
        for (int i:element.removeDuplicates(array)) {
            System.out.print(i);
        }
    }
}
